home *** CD-ROM | disk | FTP | other *** search
- /*
- File: ExamplePreflightExtension.c
-
- Note: InstallMod extensions are called by the InstallMod plug-in while it is initializing
- itself. If there is some reason to check whether a installer script under special
- circumstances should
- • Not be displayed in the Easy Install list
- • Not be displayed in the Custom Install list
- • Should have the software installer checkbox set to either checked or unchecked
- in the InstallModList.
- then writing an extension may be the best solution.
-
- For example there may be a case where some of the software to be installed is specific
- to powerbooks and you may want this installer hidden from the list if installing on desktop
- machines.
-
-
- Contains: A extension to the Upgrader 1.1 InstallMod plug-in which checks if the current machine
- is the same as the one referenced by inSoftwareInstallerPreflightPBRec->fRefCon. If the
- machine is the same then the Installer script that this extension relates to won't be
- shown in the InstallMod installation easy list.
-
- To see this the results of this extension, first compile the code resource, then add the
- resource to the ClientData (Upgrader 1.1 script) file. Then for each Installer script you'd
- like to see removed from the list on the machine selected by fRefCon, add the extension code
- resource details to the the preflight section of the software item list 'ippr' resource.
-
- These details are the type of code resource 'pffn', the id of the code resource and in the preflight
- refCon the machine id for which you want to hide an installer script.
-
-
-
- Version: 1.1
-
- Copyright: © 1997 by Apple Computer, Inc., all rights reserved.
-
- */
-
- #include <Gestalt.h>
-
- #include "InstallationPluginExt.h"
-
- // Prototype for main entry point to extension code resource
- SoftwareInstallerPreflightResult main ( SoftwareInstallerPreflightPBRec *inSoftwareInstallerPreflightPBRec );
-
- SoftwareInstallerPreflightResult main ( SoftwareInstallerPreflightPBRec *inSoftwareInstallerPreflightPBRec )
- {
- SoftwareInstallerPreflightResult theErr = kNoError;
- long machineType;
-
- //SysBeep(10);
-
- if ( inSoftwareInstallerPreflightPBRec != (SoftwareInstallerPreflightPBRec*)NULL )
- {
- theErr = Gestalt( gestaltMachineType, &machineType );
- if ( theErr == kNoError )
- {
- if ( machineType == inSoftwareInstallerPreflightPBRec->fRefCon ) // fRefCon contains a machine ID, it could also be used to contain
- // a Resource ID of a resource containing a list of machines if
- // this was necessary
- {
- inSoftwareInstallerPreflightPBRec->fSkipOnEasy = true; // we want the installer script removed from the easy install
- inSoftwareInstallerPreflightPBRec->fSkipOnCustom = false; // but left in the custom install
- inSoftwareInstallerPreflightPBRec->fOverrideDefaultSelection = false; // don't need to do this for this example
- inSoftwareInstallerPreflightPBRec->fSelectIfOverridden = false; // this value is only used if fOverrideDefaultSelection is true
- }
- }
- else
- {
- theErr = kInternalError;
- }
- }
- else
- {
- theErr = kInternalError;
- }
-
- return theErr; // if an error is returned a alert dialog will be displayed stating than an internal error occured in
- } // a preflight extension.
-